package analizator;

import analizator.Analizator.Atom;

/**
 *
 * @author bufu
 */
public class CuvantCheie implements Atom {

    public Keyword m_keyword;
    private int m_line, m_column;

    public CuvantCheie(Keyword keyword, int line, int col) {
        m_keyword = keyword;
        m_line = line;
        m_column = col;
    }

    @Override
    public String toString() {
        return "CuvantCheie " + m_keyword + " " + m_line + " " + m_column;
    }

    public enum Keyword {

        AND, ARRAY, BEGIN,
        CASE, CHAR, CONST, DIV, DO, DOWNTO, ELSE, END, FOR, FUNCTION,
        IF, INTEGER, MOD, NOT, OF, OR, PROCEDURE, PROGRAM, REAL, RECORD, REPEAT, THEN, UNTIL, VAR,
        WHILE, TO, STEP, OTHERWISE, READ, PRINT;

        /*
         * private CuvantCheie makeFrom(FileProvider provider) { Caracter c1 =
         * provider.getCharacter(), t; if (c1 == null) { return null; }
         * ArrayList<Caracter> crc = new ArrayList<>(); String compare =
         * toString().toLowerCase(); //System.out.println("comparint to:" +
         * compare); if (c1.value != compare.charAt(0)) {
         * //System.out.println("failed:" + compare.charAt(0) + "with " +
         * c1.value); provider.putCharacter(c1); return null; } crc.add(c1); for
         * (int i = 1; i < compare.length(); i++) { t = provider.getCharacter();
         * crc.add(t); if (t.value != compare.charAt(i)) {
         * //System.out.println("failed:" + compare.charAt(i) + "with " +
         * t.value + " i is" + i); provider.putCharacters(crc); return null; } }
         * return new CuvantCheie(this, c1.line, c1.column); }
         */
    }

    /*
     * public static CuvantCheie makeAtom(FileProvider provider) { CuvantCheie
     * cuvant = null; for (Keyword key : Keyword.values()) { cuvant =
     * key.makeFrom(provider); if (cuvant != null) { break; } } return cuvant; }
     */
}
